From: Florian Müllner Date: Wed, 20 Apr 2016 18:26:49 +0000 (+0200) Subject: system: Only show rotation lock when a builtin output is present X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~878 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=9c483dd9a6efb4c8022b597ca3e9bc0999dcb43d;p=gnome-shell.git system: Only show rotation lock when a builtin output is present We currently show the orientation lock button when an accelerometer is present, however gnome-settings-daemon's xrandr plugin only applies rotation when a builtin monitor is present. Update the button's visibility to match gnome-settings-daemon. https://bugzilla.gnome.org/show_bug.cgi?id=765267 --- diff --git a/js/ui/status/system.js b/js/ui/status/system.js index fb0b04037..4981d948b 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -6,6 +6,7 @@ const Gdm = imports.gi.Gdm; const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; const Lang = imports.lang; +const Meta = imports.gi.Meta; const Shell = imports.gi.Shell; const St = imports.gi.St; @@ -110,6 +111,7 @@ const Indicator = new Lang.Class({ this._session = new GnomeSession.SessionManager(); this._loginManager = LoginManager.getLoginManager(); + this._monitorManager = Meta.MonitorManager.get(); this._haveShutdown = true; this._haveSuspend = true; @@ -155,6 +157,8 @@ const Indicator = new Lang.Class({ this._orientationSettings.connect('changed::orientation-lock', Lang.bind(this, this._updateOrientationLock)); + Main.layoutManager.connect('monitors-changed', + Lang.bind(this, this._updateOrientationLock)); Gio.DBus.system.watch_name(SENSOR_BUS_NAME, Gio.BusNameWatcherFlags.NONE, Lang.bind(this, this._sensorProxyAppeared), @@ -264,7 +268,8 @@ const Indicator = new Lang.Class({ _updateOrientationLock: function() { if (this._sensorProxy) - this._orientationLockAction.visible = this._sensorProxy.HasAccelerometer; + this._orientationLockAction.visible = this._sensorProxy.HasAccelerometer && + this._monitorManager.get_is_builtin_display_on(); else this._orientationLockAction.visible = false;